package com.hitechbangla.fctu.form;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;

/**
 * A complete Java class to demonstrate the use of a JScrollPane.
 * 
 * @author alvin alexander, devdaily.com.
 *
 */
public class AircraftProperty2
{
  public static void main(String[] args)
  {
    new AircraftProperty2();
  }
  
  public AircraftProperty2()
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
          JFrame frame = new JFrame("Add Aircraft");
          
          JPanel panel = new JPanel();
          JPanel panel1=new JPanel();
          JPanel panel2=new JPanel();
                    
          
          panel.setLayout(new javax.swing.BoxLayout(panel, javax.swing.BoxLayout.Y_AXIS));
          panel2.setLayout(new javax.swing.BoxLayout(panel2, javax.swing.BoxLayout.Y_AXIS));
          
          JCheckBox ch1= new JCheckBox("ch1");
          JCheckBox ch2= new JCheckBox("ch1");
          JCheckBox ch3= new JCheckBox("ch1");
          JCheckBox ch4= new JCheckBox("ch1");
          JCheckBox ch5= new JCheckBox("ch1");
          JCheckBox ch6= new JCheckBox("ch1");
          JCheckBox ch7= new JCheckBox("ch1");      
          
          JTextField tex1 = new JTextField();tex1.setPreferredSize(new Dimension(60,20)); 
          JTextField tex2 = new JTextField();tex2.setPreferredSize(new Dimension(60,20)); 
          JTextField tex3 = new JTextField();tex3.setPreferredSize(new Dimension(60,20)); 
          JTextField tex4 = new JTextField();tex4.setPreferredSize(new Dimension(60,20)); 
          JTextField tex5 = new JTextField();tex5.setPreferredSize(new Dimension(60,20)); 
          JTextField tex6 = new JTextField();tex6.setPreferredSize(new Dimension(60,20)); 
          JTextField tex7 = new JTextField();tex7.setPreferredSize(new Dimension(60,20)); 
          
         
         
         //tp7.changeAlpha(0.5f);
         //tp7.changeStyle(Font.BOLD + Font.ITALIC);
          
         ButtonGroup grp1 = new ButtonGroup();
        // grp1.add(ch1);
        // grp1.add(ch1);
  
          panel2.add(ch1);
          panel2.add(ch2);
          panel2.add(ch3);
          panel2.add(ch4);
          panel2.add(ch5);           
          panel2.add(ch6);
          panel2.add(ch7);
          
          
          
          panel.add(tex1);
          panel.add(tex2);
          panel.add(tex3);
          panel.add(tex4);
          panel.add(tex5);
          panel.add(tex6);
          panel.add(tex7);               
         
        
            
          JButton button = new JButton("OK");
          //button.setAlignmentX(Component.RIGHT_ALIGNMENT); 
          panel1.add(button);  
          
          //frame.add(panel,BorderLayout.NORTH);
         frame.add(panel2,BorderLayout.WEST);
         frame.add(panel,BorderLayout.CENTER);
         frame.add(panel1,BorderLayout.SOUTH);   
        // create a scrollpane, givin it the textarea as a constructor argument
        JScrollPane sp1 = new JScrollPane(panel);// panel = textbox, panel2=chkbx
        JScrollPane sp2 = new JScrollPane(panel2);// panel = textbox, panel2=chkbx
        
        sp2.getVerticalScrollBar().setModel( sp1.getVerticalScrollBar().getModel() );  
        
        //sp2.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_NEVER );
        
        
        JPanel content = new JPanel(new GridLayout(1, 0));  
       
        content.add(sp1);  
        content.add(sp2);  
        
        
           
                  
        frame.getContentPane().add(content, BorderLayout.EAST);

        // make it easy to close the application
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // set the frame size (you'll usually want to call frame.pack())
        frame.setSize(new Dimension(240, 180));
        
        // center the frame
        frame.setLocationRelativeTo(null);
        
        // make it visible to the user
        frame.setVisible(true);
      }
    });
  }
}